Skip to main content

All Questions

2votes
7answers
734views

Shell Script to Normalize the data

We have requirement to normalize the data ... Item field is comma delimited and irregular and it may have any items from 0 to max (lets say 100) Input: key1|desc field|item1,item2,item3,item4|extra ...
Sanjay Dubey's user avatar
-2votes
3answers
113views

Awk to pick up json values

I am trying to get the job status from the below json file.. but while using awk it is returning { "id": 10870, "type": "job", "url": "/api/v2/...
user984993's user avatar
7votes
6answers
753views

Split column into lines using awk

I have a file that contains a long column and I want to split it into lines, each one with 5 values. E.g., Input file: 1 2 3 4 5 6 7 8 9 10 Output file: 1 2 3 4 5 6 7 8 9 10
Djabri Josef's user avatar
0votes
3answers
212views

Remove all lines between two similar patterns if a specific pattern in between is not matched

The title should be: Remove all lines between two similar patterns, including the line of the starting pattern. if another specific pattern in between is not matched. I made it shorter because its ...
pwrsheller's user avatar
3votes
5answers
478views

How to create a new column and add a random identifier to it with miller

I want to add a column with a randomly created "case number" to my csv file. The first 2 letters of the casenumber must be any letter from A-Z in capitals. followed by 5 random numbers. ...
pwrsheller's user avatar
1vote
4answers
222views

edit text/srt file

I have a .srt file like this Input File 1 00:00:17,920 --> 00:00:21,159 The essential is invisible to the eye. 3 2 00:00:21,160 --> 00:00:22,559 This phrase comes from 4 3 00:00:22,560 --> ...
dsoum's user avatar
3votes
8answers
532views

Replace last word occurrence in file

The scenario is I want to comment out the last occurrence of a word in shell script using sed. Assume I have temp.sh with the following content: Abc 123 Abc Sdf 2 Abc Abc Utyr Qww I want to replace ...
Curiouscat's user avatar
0votes
1answer
79views

What is the best practice to change variables in automations

I am trying to create auto install Ubuntu OS with packer on Hyper-V and I have project like this: packer-main/ | |--->http/ | |--->user-data | |--->templates/ | |--->build.pkr....
robotiaga's user avatar
0votes
5answers
436views

Uniquify first column and add numbers in second column in a file in linux

I am collecting data from multiple files and dumping into a single summary file. cat *files* | sort -u > final.rpt a 1 a 5 a 6 b 2 b 3 b 0 c 1 c 7 How can I uniquify based on string in first ...
Nirav's user avatar
1vote
5answers
52views

Get value after a keyword that is in the middle of the line only from given line

Hey so I have the following line in the middle of a file and I only need to get the value following "energy=". The line number is stored in a variable called "lineNumber". There ...
karri104's user avatar
0votes
1answer
310views

Auto-translation of newline characters in the terminal

I'm following along here. I notice (this is not complete, just for demonstration) that at this point: #include <termios.h> raw.c_iflag &= ~(ICRNL | IXON); raw.c_oflag &= ~(OPOST); ...
user129393192's user avatar
-1votes
1answer
79views

Why no one thought of the concept of joins before the 70s? [closed]

So, let me see if I have my history right: In 1976, the first system sold as an RDBMS was Multics Relational Data Store. I don't know if it had JOIN, but let's assume it did. The UNIX command join ...
Sebastian Carlos's user avatar
0votes
3answers
169views

linux command to remove leading whitespace

I just wanted to extract VmRSS value, but the print should not show leading whitespace renv@svr-ubt20-004:~$ cat /proc/607440/status | grep VmRSS VmRSS: 20452 kB Tried tr and cut commands and got ...
renga_in_stack's user avatar
0votes
2answers
757views

How to replace two lines at once respecting indentation with sed?

I need help to replace the below 2 lines of code in a Python file with sed. We are loading one Python file which processes some data, so we need to replace the below 2 lines of code with another line ...
Abhi Ram's user avatar
0votes
1answer
230views

ZFS script pull latest snapshot and restore

I keep my zfs snapshot backups in zfs/snapshotbackps and my virtual machghines run off direct zfs location I am trying to create a script that will pull the latest snapshot and restore it. I've tried ...
Teddy77's user avatar
  • 3,133

153050per page
close